#include <QJsonDocument>
#include <QJsonObject>
#include <QVector>

#include "camera_enmu.h"

#ifndef _HARDWARE_STATUS_H_
#define _HARDWARE_STATUS_H_

struct HardwareStatus {
    //double currentTemp = 25.0;
    double currentTemp;
    double targetTemp = -70.0;
    bool isCooling = false;
    bool tempStabilized = false;

    //double currentVacuum = 1.6e-3;
    double currentVacuum = 1000;
    double vacuumThreshold = 10;
    QVector<double> vacuumHistory;
    bool vacuumAlert = false;

    // 添加连接状态
    bool tempConnected = false;
    bool vacuumConnected = false;
    QDateTime lastTempResponseTime = QDateTime(); // 默认构造为无效
    QDateTime lastVacuumResponseTime = QDateTime(); // 默认构造为无效


    CameraState cameraState = Idle;
    bool isExposing = false;
    QDateTime lastUpdate;

    int bitsPerPixel = 16;
    int gainIndex = 0;
    int binning = 1;
    AmplifierMode amplifierMode = HighSensitivity;
    QString currentImageName;

    double exposureTime = 0;
    QString exposureType = "df";

    QJsonObject currentImgInfo;

    // 温度数据存储
    struct TemperatureData {
        double ccd1 = 120;
        double ccd2 = 110;
        double ccd3 = 130;
        double ccd4 = 95;
        double base1 = 100;
        double base2 = 168;
        double absorbCold = 0.0;
        double circuit = 0.0;
        //double circuit2 = 0.0;
        double dewar = 0.0;
        double backup1 = 0.0;
        double backup2 = 0.0;
        double outputPower = 0.0;
        double targetTemp = 0.0;
    } tempData;

    // 温度曲线系列（每个测温点一个曲线）
    QMap<QString, QtCharts::QLineSeries*> tempSeriesMap;
    QChart *multiTempChart;  // 多曲线图表
};

#endif // _HARDWARE_STATUS_H_